﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T15OOP2
{
    abstract class Product
    {
        protected string name;//产品名
        protected decimal price;//价格

        public string Name
        {
            get { return name; }
            set { name = value; }

        }
        public decimal Price
        {
            get { return price; }
            set { price = value; }
        }
        //this("")表示调用带参构造函数
        public Product() : this("")
        {
            Debug.WriteLine("-调用Product无参构造方法=-");


        }
        public Product(string name)
        {
            this.name = name;
            Debug.WriteLine("-=调用Product带参构造方法=-");

        }
        /// <summary>
        /// 显示产品基本信息
        /// </summary>
        public virtual void Show()
        {
            Console.WriteLine("产品信息：{0}", name);
            Console.WriteLine("产品价格：{0}", price);

        }
        /// <summary>
        /// 显示产品信息
        /// </summary>
        public abstract void ShowDetail();
        ~Product()
        {
            Debug.WriteLine("-= 调用Product析构方法 = -");
        }
    }
}
